<html>
<head><meta charset="utf-8"><title>layout info · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html">layout info</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200529294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200529294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200529294">(Jun 11 2020 at 10:59)</a>:</h4>
<p>To implement <code>DispatchFromDyn</code> wf checks we need two things not present in chalk: repr info (namely <code>#[repr(C)]</code> and <code>#[repr(packed)]</code>) and layout info (namely <code>is_zst</code> check and alignment).</p>



<a name="200529578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200529578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200529578">(Jun 11 2020 at 11:03)</a>:</h4>
<p>the first one is not that bad, we can make callbacks specifically for those two things and address the whole repr story when pushing for the shared type library</p>



<a name="200529849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200529849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mental <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200529849">(Jun 11 2020 at 11:06)</a>:</h4>
<p>Is there, or should there be, an tracking issue for this on the chalk repo?</p>



<a name="200529918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200529918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200529918">(Jun 11 2020 at 11:07)</a>:</h4>
<p>I was hoping to do a quick triage here</p>



<a name="200529965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200529965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200529965">(Jun 11 2020 at 11:07)</a>:</h4>
<p>And then decide how to structure the issue</p>



<a name="200530075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mental <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530075">(Jun 11 2020 at 11:09)</a>:</h4>
<p>Ah gotcha, I started with chalk a couple days ago so I'm new with the workflow.</p>



<a name="200530095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530095">(Jun 11 2020 at 11:09)</a>:</h4>
<p>So, the second one is worse, because it requires to compute layouts based on the environment and I am not sure how much of that is work for chalk (doesn't feel like it at least)</p>



<a name="200530314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530314">(Jun 11 2020 at 11:12)</a>:</h4>
<p>Or is it?</p>



<a name="200530355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mental <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530355">(Jun 11 2020 at 11:12)</a>:</h4>
<p>I guess it'd depend on the environment, if chalk is responsible for rendering it directly more than rustc then I feel like the ball would be in Chalks court</p>



<a name="200530579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mental <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530579">(Jun 11 2020 at 11:15)</a>:</h4>
<p>I'm not sure when/how the layout is computed within rustc but could it not be queried by chalk when needed like other information (via the RustIRDatabase?)</p>



<a name="200530667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530667">(Jun 11 2020 at 11:16)</a>:</h4>
<p>That would require to map chalk environment to rustc environment</p>



<a name="200530696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530696">(Jun 11 2020 at 11:16)</a>:</h4>
<p>Which is uhh not sure if that's possible</p>



<a name="200530701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530701">(Jun 11 2020 at 11:16)</a>:</h4>
<p>At least easily</p>



<a name="200530807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530807">(Jun 11 2020 at 11:18)</a>:</h4>
<p><code>DispatchFromDyn</code> is an unstable obscure trait with not that much implementors, I haven't done extensive research but I feel like we can just tighten it's requirements so we won't have to compute the layout, at least for now</p>



<a name="200530957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530957">(Jun 11 2020 at 11:20)</a>:</h4>
<p>For example, instead of zst we can require <code>PhantomData</code></p>



<a name="200530977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200530977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200530977">(Jun 11 2020 at 11:20)</a>:</h4>
<p>Like <code>CoerceUnsized</code> does</p>



<a name="200580885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200580885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200580885">(Jun 11 2020 at 17:50)</a>:</h4>
<p>ugh I <em>almost</em> want to say "can't we just delegate the <code>DispatchFromDyn</code> check to rustc"</p>



<a name="200580911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200580911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200580911">(Jun 11 2020 at 17:50)</a>:</h4>
<p>ikr</p>



<a name="200580936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200580936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200580936">(Jun 11 2020 at 17:50)</a>:</h4>
<p>I don't <em>really</em> want to start thinking about layout and repr in Chalk</p>



<a name="200581252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200581252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200581252">(Jun 11 2020 at 17:52)</a>:</h4>
<p>Can someone explain more of what it's for exactly?</p>



<a name="200581755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200581755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200581755">(Jun 11 2020 at 17:56)</a>:</h4>
<p>It's needed to quote "Checks the method's receiver (the <code>self</code> argument) can be dispatched on when <code>Self</code> is a trait object."</p>



<a name="200581876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200581876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200581876">(Jun 11 2020 at 17:57)</a>:</h4>
<p>See <code>librstc_trait_selection::traits::object_safety::receiver_is_dispatchable</code></p>



<a name="200582816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200582816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200582816">(Jun 11 2020 at 18:04)</a>:</h4>
<p>bleh</p>



<a name="200583193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200583193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200583193">(Jun 11 2020 at 18:06)</a>:</h4>
<p>Fun fact it was previously called <code>CoerceSized</code></p>



<a name="200583372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200583372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200583372">(Jun 11 2020 at 18:07)</a>:</h4>
<p>Don't know if that's a <em>fun</em> fact</p>



<a name="200583407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200583407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200583407">(Jun 11 2020 at 18:07)</a>:</h4>
<p>Deep rust lore</p>



<a name="200583781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200583781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200583781">(Jun 11 2020 at 18:10)</a>:</h4>
<p>I want out</p>



<a name="200583809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200583809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200583809">(Jun 11 2020 at 18:10)</a>:</h4>
<p>This is another "rust-call" situtation</p>



<a name="200585933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200585933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200585933">(Jun 11 2020 at 18:26)</a>:</h4>
<p>So</p>



<a name="200585951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200585951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200585951">(Jun 11 2020 at 18:26)</a>:</h4>
<p>I think that (a) layout should not be chalk's job</p>



<a name="200585958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200585958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200585958">(Jun 11 2020 at 18:27)</a>:</h4>
<p>(b) mapping chalk -&gt; rust environments should be trivial</p>



<a name="200585982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200585982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200585982">(Jun 11 2020 at 18:27)</a>:</h4>
<p>I hope that they will, indeed, be the <em>same environments</em></p>



<a name="200585985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200585985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200585985">(Jun 11 2020 at 18:27)</a>:</h4>
<p>Huh, really, ok</p>



<a name="200586008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586008">(Jun 11 2020 at 18:27)</a>:</h4>
<p>that is the goal of the whole "extract shared type library"</p>



<a name="200586015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586015">(Jun 11 2020 at 18:27)</a>:</h4>
<p>now, mind you, this is not the case <em>now</em></p>



<a name="200586026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586026">(Jun 11 2020 at 18:27)</a>:</h4>
<p>so there is a bit of a mismatch there</p>



<a name="200586057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586057">(Jun 11 2020 at 18:27)</a>:</h4>
<p>but I think we should define the callbacks to give a chalk environment</p>



<a name="200586069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586069">(Jun 11 2020 at 18:28)</a>:</h4>
<p>and we can try to bridge it in some way ;)</p>



<a name="200586141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586141">(Jun 11 2020 at 18:28)</a>:</h4>
<p>I suppose if we included a def-id in the chalk environment we could recreate the corresponding environment on the rustc side or something</p>



<a name="200586163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586163">(Jun 11 2020 at 18:28)</a>:</h4>
<p>wait, what environment is this</p>



<a name="200586190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586190">(Jun 11 2020 at 18:28)</a>:</h4>
<p><code>ParamEnv</code></p>



<a name="200586206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586206">(Jun 11 2020 at 18:28)</a>:</h4>
<p>Why is it needed?</p>



<a name="200586240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586240">(Jun 11 2020 at 18:28)</a>:</h4>
<p>To compute the layout of generic types, if possible</p>



<a name="200586244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586244">(Jun 11 2020 at 18:28)</a>:</h4>
<p>Or, I should say</p>



<a name="200586263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586263">(Jun 11 2020 at 18:29)</a>:</h4>
<p>because layout might do trait solving, is why</p>



<a name="200586275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586275">(Jun 11 2020 at 18:29)</a>:</h4>
<p>and resolve associated type</p>



<a name="200586283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586283">(Jun 11 2020 at 18:29)</a>:</h4>
<p>so <em>really</em> it's going to come back to chalk :)</p>



<a name="200586341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586341">(Jun 11 2020 at 18:29)</a>:</h4>
<p>well, when would we need it that we don't already have it?</p>



<a name="200586372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586372">(Jun 11 2020 at 18:29)</a>:</h4>
<p>maybe I don't know what all is actually in the <code>ParamEnv</code></p>



<a name="200586507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586507">(Jun 11 2020 at 18:30)</a>:</h4>
<p>I can't parse the question</p>



<a name="200586547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200586547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200586547">(Jun 11 2020 at 18:30)</a>:</h4>
<p>So, I mean when we solve a goal, that's in an <code>Environment</code></p>



<a name="200587087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200587087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200587087">(Jun 11 2020 at 18:34)</a>:</h4>
<p>So the proposed solution (at least for now) is to add a callback that, given some environment, computes relevant for chalk layout parameters?</p>



<a name="200587112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200587112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200587112">(Jun 11 2020 at 18:34)</a>:</h4>
<p>Sounds good enough</p>



<a name="200587640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200587640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200587640">(Jun 11 2020 at 18:39)</a>:</h4>
<p>As for <code>repr</code> I presume we add a callback that returns repr data?</p>



<a name="200587691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200587691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200587691">(Jun 11 2020 at 18:39)</a>:</h4>
<p>(As opposed to making it into adt flags)</p>



<a name="200588057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200588057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200588057">(Jun 11 2020 at 18:42)</a>:</h4>
<p>I think we should be moving towards callbacks probably</p>



<a name="200588067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200588067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200588067">(Jun 11 2020 at 18:42)</a>:</h4>
<p>rather than constructing complex data types</p>



<a name="200588172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200588172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200588172">(Jun 11 2020 at 18:43)</a>:</h4>
<p>I'll make issues for them then, they seem like good first issues for all the people who joined recently</p>



<a name="200590015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200590015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200590015">(Jun 11 2020 at 18:59)</a>:</h4>
<p>wait so why bother adding the repr and layout complexity at all</p>



<a name="200590208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200590208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200590208">(Jun 11 2020 at 19:01)</a>:</h4>
<p>I guess let's start with: what <em>exactly</em> are the goals we are getting for these that we need to solve</p>



<a name="200590468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200590468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200590468">(Jun 11 2020 at 19:03)</a>:</h4>
<p>So, <a href="https://github.com/rust-lang/rust/blob/3d8a0733ae58749db958e929aa14108b869f7540/src/librustc_typeck/coherence/builtin.rs#L146">this</a> is the wf check for <code>DispatchFromDyn</code></p>



<a name="200590521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200590521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200590521">(Jun 11 2020 at 19:03)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/3d8a0733ae58749db958e929aa14108b869f7540/src/librustc_typeck/coherence/builtin.rs#L195">Here</a> It checks struct repr</p>



<a name="200590604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200590604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200590604">(Jun 11 2020 at 19:04)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/3d8a0733ae58749db958e929aa14108b869f7540/src/librustc_typeck/coherence/builtin.rs#L212">Here</a> is layout check</p>



<a name="200590699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200590699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200590699">(Jun 11 2020 at 19:05)</a>:</h4>
<p>So, repr c and repr packed structs can't implement <code>DispatchedFromDyn</code></p>



<a name="200591063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200591063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200591063">(Jun 11 2020 at 19:08)</a>:</h4>
<p>And we need to check that there is exactly 1 field where two structs differ, ignoring zst fields with alignment=1 (i.e. fields that do not affect struct layout)</p>



<a name="200591265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200591265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200591265">(Jun 11 2020 at 19:10)</a>:</h4>
<p>By two structs I mean "coercion source and target instances of the same struct"</p>



<a name="200594878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200594878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200594878">(Jun 11 2020 at 19:38)</a>:</h4>
<p>Why not just add a callback in RustIrDatabase <code>is_dyn_dispatchable</code></p>



<a name="200594899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200594899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200594899">(Jun 11 2020 at 19:38)</a>:</h4>
<p>Which, is not great</p>



<a name="200594943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200594943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200594943">(Jun 11 2020 at 19:39)</a>:</h4>
<p>but potentially better than adding a lot of extra complexity in the form of reprs and layouts</p>



<a name="200594956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200594956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200594956">(Jun 11 2020 at 19:39)</a>:</h4>
<p>(even if we don't <em>compute</em> it)</p>



<a name="200596577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200596577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200596577">(Jun 11 2020 at 19:51)</a>:</h4>
<p>Hmm, it is possible</p>



<a name="200597294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200597294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200597294">(Jun 11 2020 at 19:55)</a>:</h4>
<p>I don't know, umm</p>



<a name="200597794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200597794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200597794">(Jun 11 2020 at 19:59)</a>:</h4>
<p>So we won't have benefits of lazy normalization in that specific case</p>



<a name="200597957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200597957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200597957">(Jun 11 2020 at 20:00)</a>:</h4>
<p>I feel like considering that it's the last piece of well known trait logic, it's a relatively small price to keep everything nice and tidy</p>



<a name="200599351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200599351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200599351">(Jun 11 2020 at 20:10)</a>:</h4>
<p>you're probably right</p>



<a name="200607479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/layout%20info/near/200607479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/layout.20info.html#200607479">(Jun 11 2020 at 21:16)</a>:</h4>
<p>filed</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>